package com.xsherl.leetcode.solution;

/**
 * @Author: sherl
 * @Date: 2021/5/24 20:53
 */
public class ParenthesisValidation {

    private boolean valid(char[] chars){
        int i = 0;
        for (char c: chars){
            if (c == '('){
                i++;
            } else {
                i--;
                if (i < 0){
                    return false;
                }
            }
        }
        return i == 0;
    }

}
